6df7f2
@@ -334,14 +334,15 @@
class AsyncNonMetaRegionLocator {
 
   private HRegionLocation locateRowBeforeInCache(TableCache tableCache, TableName tableName,
       byte[] row) {
+    boolean isEmptyStopRow = isEmptyStopRow(row);
     Map.Entry<byte[], HRegionLocation> entry =
-      isEmptyStopRow(row) ? tableCache.cache.lastEntry() : tableCache.cache.lowerEntry(row);
+        isEmptyStopRow ? tableCache.cache.lastEntry() : tableCache.cache.lowerEntry(row);
     if (entry == null) {
       return null;
     }
     HRegionLocation loc = entry.getValue();
     if (isEmptyStopRow(loc.getRegion().getEndKey()) ||
-      Bytes.compareTo(loc.getRegion().getEndKey(), row) >= 0) {
+      (!isEmptyStopRow && Bytes.compareTo(loc.getRegion().getEndKey(), row) >= 0)) {
       if (LOG.isTraceEnabled()) {
         LOG.trace("Found " + loc + " in cache for '" + tableName + "', row='" +
           Bytes.toStringBinary(row) + "', locateType=" + RegionLocateType.BEFORE);
